home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 3992 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  982 b 

  1. Path: news.nstn.ca!news
  2. From: nstn181a@fox.nstn.ca (Pierre G. Boutquin)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Q:order of evaluation
  5. Date: Fri, 26 Jan 96 22:12:53 -0400
  6. Organization: Nova Scotia Technology Network
  7. Message-ID: <4ec59t$f3n@news.nstn.ca>
  8. NNTP-Posting-Host: toronto-ts-25.nstn.ca
  9.  
  10. In <4eb6kq$ksf@gazette.tandem.com>, yun_yeogirl writes:
  11. >Michael M Rubenstein wrote :
  12. >
  13. >        [Example:
  14. >          i = v[i++];      // the behavior is undefined
  15. >          i = 7,i++,i++;   // `i' becomes 9
  16. >
  17. >          i = ++i + 1;     // the behavior is undefined
  18. >          i = i + 1;       // the value of 'i' is incremented
  19. >
  20. >The first and third statement seem clear to me. I don't see why they are
  21. >undefined. I guess you made a typo here. Maybe you meant :
  22. >
  23. >    i + v[i++] and i + (++i + 1).
  24. >
  25. >If I am wrong, please enlighten me.
  26.  
  27. You _are_ wrong.  They seem clear, but are undefined _by convention_.
  28. i = v[i++]; is given in ARM as an example at the start of Chapt. 5.
  29.  
  30. Pierre.
  31.